# Contributor: Marios Paouris <mspaourh@gmail.com>

_realname=stoken
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.92
pkgrel=1
pkgdesc="RSA SecurID-compatible software token for Linux/UNIX systems. (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://stoken.sf.net"
license=('spdx:LGPL-2.1-or-later')
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-autotools")
depends=("${MINGW_PACKAGE_PREFIX}-libxml2" "${MINGW_PACKAGE_PREFIX}-nettle")
source=("https://sourceforge.net/projects/stoken/files/${_realname}-${pkgver}.tar.gz"{,.asc})
sha256sums=('aa2b481b058e4caf068f7e747a2dcf5772bcbf278a4f89bc9efcbf82bcc9ef5a'
            'SKIP')
validpgpkeys=('45DFF2D5205FE8CD74C2EE6C63B81599BC0B0D65') # Kevin Cernekee <cernekee@gmail.com>

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}
  ./autogen.sh
}

build() {
  mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"

  #export lt_cv_deplibs_check_method='pass_all'

  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --disable-dependency-tracking \
    --without-tomcrypt \
    --without-gtk 

  make 
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"
  make DESTDIR="${pkgdir}" install

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING.LIB" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE.LIB"
}
